#ifndef __BOOK_H
#define __BOOK_H
#include <iostream>
#include <list>

using namespace std;

class Book
{
public:
	int id;
	string ISDN;
	string name;
	Book(string ISDN, string name);
	Book(int id, string ISDN, string name);

	static list<Book> BookList;
	static int getNextBookId();

	friend istream& operator>>(istream& input, Book& b);
	friend ostream& operator<<(ostream& output, const Book& b);
	friend bool operator==(const Book& a, const Book& b);

	static string toJson();
	static list<Book> fromJson(string);

	static Book* queryById(int);
	static Book* queryByName(string);
	static Book* queryByISDN(string);
	static int delById(int);

	static void addBook();
	static void listBook();
	static void delBook();

	static const char* file_name;
	static void saveFile();
	static void loadFromFile();
};
#endif
